//
//  ForgetPasswordViewController.m
//  TravelDiary
//
//  Created by lanou3g on 15/11/19.
//  Copyright © 2015年 YDB MAC. All rights reserved.
//

#import "ForgetPasswordViewController.h"
#import <AVOSCloud.h>

@interface ForgetPasswordViewController ()

@end

@implementation ForgetPasswordViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    
    
    
}
- (IBAction)submitClick:(UIButton *)sender {
    
    [AVUser requestPasswordResetForEmailInBackground:self.emailLabel.text block:^(BOOL succeeded, NSError *error) {
        if (succeeded) {
            
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"修改密码发送成功,请到邮箱进行重设!" preferredStyle:UIAlertControllerStyleAlert];
            
            UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
                
            }];
            [alert addAction:action];
            [self presentViewController:alert animated:YES completion:nil];
            
        } else {
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"邮箱或网络错误!" preferredStyle:UIAlertControllerStyleAlert];
            
            UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
                
            }];
            [alert addAction:action];
            [self presentViewController:alert animated:YES completion:nil];
        }
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
